Skip to content

fix: harden outside-agent requests, Windows program starts, raw file serving and environment reads - #17

Merged
nodemode-ai merged 9 commits into
mainfrom
fix/review-2026-11-28
Nov 29, 2026
Merged

nodemode-ai merged 9 commits into
mainfrom
fix/review-2026-11-28

Conversation

@gbarnai

@gbarnai gbarnai commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The request to allow an outside agent's call now lists the arguments the call names. The tool's own arguments come first, with long lines shortened in the middle so their ends stay visible. A last line says how many arguments were left out. Hidden characters are shown as escapes. A path with parent steps is shown with those steps resolved, as the system will resolve them.
  • On Windows, an npm-style .cmd or .bat shim is started as the program it names (node with the script, or the .exe beside it), so the words reach that program unchanged. A batch-file node found on PATH is never started directly.
  • A batch file that cannot be read that way still goes through cmd /c. Words with control characters, a percent sign or a double quote are refused. Operators are refused unless the word is quoted. When the batch file's own path needs quotes, operators are refused everywhere, and so are other quoted words.
  • /api/file/raw and /api/model/asset now send X-Content-Type-Options: nosniff and Content-Security-Policy: sandbox, so served files open as inert documents.
  • The env_read MCP tool now blanks values and marks them hidden when a variable's name looks like a key, token or password, or when its value looks like a well-known token or a signed-in address. The formtools window still shows every value.
  • The shared agent finder (agent_lookup.py) moves to 1.0.2, with its hash recorded in setup/agents.py.
  • Tests cover each change, and each new test fails on the previous code.
  • On Windows, a batch file that cannot be resolved to its own program goes through the command interpreter only when no word contains a control character or any of & | < > ^ ( ) ! % and the double quote, with or without spaces. Otherwise the start is refused and the message says to pass long text through standard input or a file.
  • npm-style .cmd shims start the node script or exe they wrap directly, with the arguments unchanged.
  • The prompt to allow an outside agent's call lists only the arguments the tool declares, and a call with any other argument is refused before anyone is asked.
  • The prompt puts path, folder and target arguments first, quotes values, shows the end of long paths, marks every shortened value with its full length, says how many arguments are not shown, and names the agent that sent them.

Tests

  • Each fix has a test that fails on the previous code where practical.
  • The repo CI commands were run locally on macOS. Every failure seen locally also fails on main in the same environment (missing local tools or platform-specific tests); none is introduced here.
  • Please rely on this PR's CI run for Linux and Windows.

For the owner

  • A few related items need an owner decision; they are listed separately, not here.

How to ship

  • Independent of other repos; merge in any order. No version bump; release as usual.

…se words the command interpreter would reread
…e's own path is quoted, and never start a batch-file node directly
…many were left out, and show where parent steps in a path lead
…hen a batch file must go through it

A word with a control character or one of & | < > ^ ( ) ! % and the double quote is now refused whether or not it has spaces, and the message says to pass long text through standard input or a file. npm-style shims still start their own program directly with the words unchanged.
…and mark shortened values, and name the sending agent

A call that names an argument its tool does not declare is refused before anyone is asked. Path, folder and target arguments come first, long paths show their end, and every shortened value says its full length.
@gbarnai
gbarnai requested a review from nodemode-ai as a code owner November 29, 2026 18:19
@nodemode-ai
nodemode-ai merged commit 3c0b49d into main Nov 29, 2026
6 checks passed
@nodemode-ai
nodemode-ai deleted the fix/review-2026-11-28 branch November 29, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants